package com.hjq.base.http

import com.hjq.base.app.ServerConfig
import com.hjq.http.config.IRequestBodyStrategy
import com.hjq.http.config.IRequestServer
import com.hjq.http.model.CacheMode
import com.hjq.http.model.RequestBodyType


/**
 *    desc   : 服务器配置
 */
class RequestServer : IRequestServer {

    override fun getHost(): String {
        return ServerConfig.getIp()
    }

//    override fun getPath(): String {
//        return "api/"
//    }

    override fun getCacheMode(): CacheMode {
        // 只在请求失败才去读缓存
        return CacheMode.USE_CACHE_AFTER_FAILURE
    }

    override fun getBodyType(): IRequestBodyStrategy {
        // 以表单的形式提交参数
        return RequestBodyType.FORM
    }
}